{include file="public/header" /}
<article class="page-container">
    <form action="" method="post" class="form form-horizontal" id="form-add">
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>上级账号(手机号)：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  placeholder="" id="parent" name="parent" autocomplete="off">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>用户账号(手机号)：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  placeholder="" id="username" name="username" autocomplete="off">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">
                团队等级：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select name="level" class="select">
                    {foreach $levels as $v}
                    {if $v.level == 0}
                    <option value="{$v.level}" selected>{$v.name}</option>
                    {else/}
                    <option value="{$v.level}">{$v.name}</option>
                    {/if}

                    {/foreach}
                </select>
            </div>
            <div class="col-4"> </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">
                紧急联系人姓名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" name="nickname" placeholder="" value="{$row.nickname|default=''}">
            </div>
            <div class="col-4"> </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">
                紧急联系人电话：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" name="contact" placeholder="" value="{$row.contact|default=''}">
            </div>
            <div class="col-4"> </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">
                二级密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" name="level_pass" placeholder="请输入管理员的二级密码" value="">
            </div>
            <div class="col-4"> </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input type="hidden" value="{$row.id|default=''}" name="id">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

{include file="public/footer" /}
<script type="text/javascript">
$(function(){
    $("#form-add").validate({
        rules:{
            username:{
                required:true,
                maxlength:50
            },
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            $(form).ajaxSubmit({
                success:function(data){
                    console.log(data);
                    if(data.status == 'y'){
                        layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.location.reload();
                            parent.layer.close(index);
                        });
                    }else{
                        layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                    }
                },
                error:function(error){
                    layer.msg('系统发生了错误',{icon:2,time:3000,shade: [0.5, '#FF0000']});
                }
            });

        }
    });
});
</script> 
